import request from '../../utils/request';
import config from '../../utils/config';

const { api } = config;
const { customer: {
  findCustomerSearchDisplayFieldConfigInfos,
  findCustomerSearchDisplayFieldExportConfigInfos,
} } = api;

type FindCustomerSearchDisplayFieldConfigInfosInput = {
}
type FindCustomerSearchDisplayFieldConfigInfosOutput = {
  code: number,
  note: string,
  records: {
		id: string,	//节点ID
		fid: string,	//父ID
		grad: string,	//节点级别
		type: string,	//节点类型
		name: string,	//显示名称
		indxCode: string,	//元数据编码
		sort: string,	//显示顺序
		ordeType: string,	//排序类型0|不排序;1|数值排序;2|关联排序
		dispPosi: string,	//显示位置1|左对齐；2|右对齐；3|居中
		dispLen: string,	//显示长度
		isDefDisp: string,	//默认显示0|否;1|是
		indxValType: string,	//元数据取值类型1|字典;2|查询对象接口;3|数值范围;4|具体值;5|日期范围
		indxValObj: string,	//元数据取值对象
		spefExpl: string,	//口径说明
		isExpt: string,	//是否导出1|默认导出;2|支持导出;3|不支持导出
	}[]
};
// 查询客户检索显示列配置
export async function FindCustomerSearchDisplayFieldConfigInfos(payload: FindCustomerSearchDisplayFieldConfigInfosInput): Promise<FindCustomerSearchDisplayFieldConfigInfosOutput> {
  const option = {
    url: findCustomerSearchDisplayFieldConfigInfos, // crm/v1/customer/search/displayfield/config
    method: 'GET',
    data: payload,
  };
  return request(option);
}

type FindCustomerSearchDisplayFieldExportConfigInfosInput = {
}
type FindCustomerSearchDisplayFieldExportConfigInfosOutput = {
  code: number,
  note: string,
  records: {
		esCode: string,	//es代码
		name: string,	//名称
		isExpt: string,	//是否导出
		srchLamd: string,	//搜索表达式
		replLamd: string,	//替换表达式
	}[]
};
// 查询客户检索显示列导出配置
export async function FindCustomerSearchDisplayFieldExportConfigInfos(payload: FindCustomerSearchDisplayFieldExportConfigInfosInput): Promise<FindCustomerSearchDisplayFieldExportConfigInfosOutput> {
  const option = {
    url: findCustomerSearchDisplayFieldExportConfigInfos, // crm/v1/customer/search/displayfield/exportconfig
    method: 'GET',
    data: payload,
  };
  return request(option);
}
